<template>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <blockquote class="layui-elem-quote">欢迎管理员：
                        <span class="x-red">{{user}}</span>！当前时间：{{nowDateTime}}
                    </blockquote>
                </div>
                    <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-header">基本信息</div>
                        <div class="layui-card-body ">
                            <table class="layui-table">
                                <tbody>
                                    <tr>
                                        <th>vue版本</th>
                                        <td>2.6.12</td>
                                    </tr>
                                    <tr>
                                        <th>node版本</th>
                                        <td>14.16.1</td>
                                    </tr>
                                    <tr>
                                        <th>npm版本</th>
                                        <td>6.14.2</td>
                                    </tr>
                                    <tr>
                                        <th>操作系统信息</th>
                                        <td>{{systemMsg[1]}}</td>
                                    </tr>
                                    <tr>
                                        <th>操作系统CPU线程数</th>
                                        <td>{{hardwareConcurrency}}</td>
                                    </tr>
                                    <tr>
                                        <th>是否启用cookie</th>
                                        <td>{{cookieEnabled}}</td>
                                    </tr>
                                        <tr>
                                        <th>地区</th>
                                        <td>{{cname}}</td>
                                    </tr>
                                    <tr>
                                        <th>外网ip</th>
                                        <td>{{cip}}</td>
                                    </tr>
                                    <tr>
                                        <th>版权所有</th>
                                        <td>腾风(深圳)网络科技有限公司</td>
                                    </tr>
                                    <tr>
                                        <th>开发者</th>
                                        <td>Taurus</td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</template>
<script>
export default {
    name:'Home',
    data(){
        return{
            user:"",
            nowDateTime:'',
            cip:'',
            cookieEnabled:'',
            deviceMemory:'',
            hardwareConcurrency :'',
            systemMsg:'',
            cname:''
        }
    },
    mounted(){
        //获取登录用户信息
        this.user=sessionStorage.getItem("user");
        //获取cip地址
        this.cip= returnCitySN["cip"];
        //获取登录用户的地址信息
        this.cname=returnCitySN["cname"];
        //获取cookie是否启用信息
        this.cookieEnabled=navigator.cookieEnabled;
        //获取线程数
        this.deviceMemory=navigator.deviceMemory;
        //操作系统CPU线程数
        this.hardwareConcurrency =navigator.hardwareConcurrency;
        //获取系统信息
        let txt= navigator.userAgent;
        let reg = /\((.*?)\)/;
        this.systemMsg = reg.exec(txt);
        //获取系统时间实时刷新
        this.currentTime();
    },
    methods:{
        //获取本地ip地址
        getTime(){
            var _this = this;
            let yy = new Date().getFullYear();
            let mm = new Date().getMonth()+1;
            let dd = new Date().getDate();
            let hh = new Date().getHours();
            let mf = new Date().getMinutes()<10 ? '0'+new Date().getMinutes() : new Date().getMinutes();
            let ss = new Date().getSeconds()<10 ? '0'+new Date().getSeconds() : new Date().getSeconds();
            _this.nowDateTime = yy+'-'+mm+'-'+dd+' '+hh+':'+mf+':'+ss;
        },
      //时间实时刷新
      currentTime(){
        setInterval(this.getTime,500)
      },
    }
}
</script>